import 'dart:convert';

import 'package:flutter/material.dart';
import 'package:flutter/services.dart';

import 'models/property_model.dart';

void main() {
  runApp(MyApp());
}

class MyApp extends StatefulWidget {
  MyApp({Key key}) : super(key: key);

  @override
  _MyAppState createState() => _MyAppState();
}

class _MyAppState extends State<MyApp> {
  Future<String> loadPropertyFromAssets() async {
    return await rootBundle.loadString('assets/property.json');
  }

  Future loadPorperty() async {
    String jsonString = await loadPropertyFromAssets();
    final jsonResponse = json.decode(jsonString);
    PropertyResponseModel model = PropertyResponseModel.fromJson(jsonResponse);
    print('responseData = ${model.resultData}');
    PropertyModel propertyModel = model.resultData[0];
    // ignore: unnecessary_brace_in_string_interps
    print('property = ${propertyModel.attrName}');
  }

  @override
  void initState() {
    super.initState();
    loadPorperty();
  }

  @override
  Widget build(BuildContext context) {
    return Container(
      child: null,
    );
  }
}
